package com.zrrd.io.bufferedStream;

import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.IOException;

/**
 * @author WanJl
 * @version 1.0
 * @title BufferedInputStreamDemo01
 * @description
 * @create 2023/9/24 10:27
 */
public class BufferedInputStreamDemo01 {
    public static void main(String[] args) throws IOException {
        //创建字节输入流
        FileInputStream fis=new FileInputStream("D:/wanjl.txt");
        //创建字节输入缓冲流
        BufferedInputStream bis=new BufferedInputStream(fis);
        //读取一个字节，将文件中的数据读取到字节输入缓冲流。
        //int read = bis.read();
        //System.out.println((char) read);
        byte[] bytes=new byte[1024];
        int length;
        while ((length= bis.read(bytes))!=-1){
            System.out.println(new String(bytes,0,length));
        }

        bis.close();
        fis.close();
    }
}
